package com.item.audrey_hepburn.controller.db2;




import com.item.audrey_hepburn.entity.db2.ResultMap;
import org.apache.shiro.authc.AccountException;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ExceptionController {



    // 捕捉 CustomRealm 抛出的异常
    @ExceptionHandler(AccountException.class)
    public ResultMap handleShiroException(Exception ex) {
        ResultMap resultMap= ResultMap.getResultMap();
        resultMap.setSuccess("异常");
        resultMap.setMessage(ex.getMessage());
        return resultMap;

    }


}